import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      '@public': fileURLToPath(new URL('./public', import.meta.url)),
      '@assets': fileURLToPath(new URL('./src/assets', import.meta.url)),
    },
  },
  server: {
    proxy: {
      '/webApi': {
        target: 'http://localhost:3000',
        changeOrigin: true,
      },
    },
  },
  css: {
    // 要使用sass功能需要在这里加入scss
    preprocessorOptions: {
      // 导入scss预编译程序
      scss: {
        additionalData: `@use "@assets/global.scss" as *;`,
      },
    },
  },

})
